#include "IImage.h"

namespace SF
{
	class SFTGAImg : public IImage
	{
	public:
		SFTGAImg();
		virtual ~SFTGAImg();
		virtual int Load(const char* szFilename);
		virtual int GetBPP();
		virtual int GetWidth();
		virtual int GetHeight();
		virtual unsigned char* GetImg(void);      
		virtual bool DownSampling(void);
		virtual unsigned char* GetPalette(void);

	protected:
		int ReadHeader();
		int LoadRawData();
		int LoadTgaRLEData();
		int LoadTgaPalette();
		void BGRtoRGB();
		void FlipImg();
		unsigned char *GetPixel(int x, int y);

	private:
		short int m_siWidth,m_siHeight,m_siBPP;
		unsigned long m_slImageSize;
		bool m_bEnc;
		unsigned char *m_pucImage;
		unsigned char *m_pucPalette;
		unsigned char *pucData;
	};
}
